package com.hung.triple.provider;

import com.hung.triple.bootstrap.annotation.TripleProvider;
import lombok.AllArgsConstructor;
import org.springframework.context.ApplicationContext;

import java.util.Collection;

/**
 * 支持 Spring 框架
 *
 * @author Hung
 * @since 2022/9/18
 */
@AllArgsConstructor
public class SpringProviderFactory extends ProviderFactory {

    private final ApplicationContext ctx;

    @Override
    protected Collection<Object> providerBeans() {
        return ctx.getBeansWithAnnotation(TripleProvider.class).values();
    }
}
